package com.zzty.txj.controller;


import com.zzty.txj.entity.Clazz;
import com.zzty.txj.entity.User;
import com.zzty.txj.service.ClazzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;

@Controller
@RequestMapping("/clazz")

public class ClazzController {
    @Autowired
    ClazzService clazzServiceImpl;
    @RequestMapping(value = "/getClazz")
    @ResponseBody
    public List<Clazz> getClazz(){
        List<Clazz>clazzes=clazzServiceImpl.getClazz();
        if(clazzes==null){
            return  null;
        }else{

        return clazzes;}
    }
    @RequestMapping(value = "/getUsers")
    @ResponseBody
    public List<User> getUsers(Clazz clazz){
    List<User> users = clazzServiceImpl.getUsers(clazz);
    if(users==null){
        return  null;
    }

        return users;
    }

}
